#include "stdafx.h"
#include "Dwarf.h"


CDwarf::CDwarf(DwarfType type):
m_type(type)
{
}


CDwarf::~CDwarf()
{
}

DwarfType CDwarf::GetType()
{
    return m_type;
}

std::string CDwarf::GetTypeStr()
{
    switch (m_type)
    {
    case DWARF_FARMER:
        return "Farmer";
    case DWARF_WARRIOR:
        return "Warrior";
    case DWARF_CRAFTSMAN:
        return "Craftsman";
    case DWARF_MINER:
        return "Miner";
    }
    //return "";
    std::string type = DwarfTypeToStr(DWARF_FARMER);
    return type;
}

void CDwarf::SetType(DwarfType type)
{
    m_type = type;
}

std::string DwarfTypeToStr(DwarfType type)
{
    switch (type)
    {
    case DWARF_FARMER:
        return "Farmer";
    case DWARF_WARRIOR:
        return "Warrior";
    case DWARF_CRAFTSMAN:
        return "Craftsman";
    case DWARF_MINER:
        return "Miner";
    }
    return "";
}

DwarfType GetDwarfType(std::string str)
{
    if (str == "farmer")
    {
        return DWARF_FARMER;
    }
    else if (str == "warrior")
    {
        return DWARF_WARRIOR;
    }
    else if (str == "craftsman")
    {
        return DWARF_CRAFTSMAN;
    }
    else if (str == "miner")
    {
        return DWARF_MINER;
    }
    else
    {
        return DWARF_NONE;
    }

}